#ifndef _CITY_H
#define _CITY_H

#include <list>
#include <memory>
#include "common.h"
#include "buildable.h"

class Map;
class Clock;
class Residential;
class Commercial;
class Industrial;
class Road;

class City
{
public:
    City();

    void eventHandle(sf::Event event);
    void inputHandle();
    void update(double dt);
    void tick();

    void place(Buildable::Type type, Buildable::Density density, sf::Vector2i tileCoords);
    void build(sf::Vector2i tileCoords);
    void destroy(sf::Vector2i tileCoords);

    void    setCityName(String name){cityName = name;}
    String  getCityName(){return cityName;}
    void    setMayorName(String name){mayorName = name;}
    String  getMayorName(){return mayorName;}

    void    setMoney(int amt){money = amt;}
    int     getMoney(){return money;}
    void    addMoney(int amt){money += amt;}
    void    subtractMoney(int amt){money -= amt;}

    int     getPopulation(){return population;}

    Map*    getMap(){return map;}

    Buildable* createBuildable(Buildable::Type type, Buildable::Density density, sf::Vector2i tileCoords);

    const std::list<std::unique_ptr<Buildable>>& getBuildables(){return buildables;}

private:
    String cityName;
    String mayorName;

    int money;
    int population;

    Map*    map;
    Clock*  clock;

    typedef std::list<std::unique_ptr<Buildable>> BuildableList;
    BuildableList buildables;

    std::list<Residential*> residentialBuildings;
    std::list<Commercial*>  commercialBuildings;
    std::list<Industrial*>  industrialBuildings;
    std::list<Road*>        roads;

};

#endif
